package test.format_test;

import java.util.Calendar;

/**
 * @author ：蔡博
 * @description：TODO
 * @date ：2022/4/18 19:47
 */
public class ForStatic {
    public static void main(String[] args) {
        System.out.println(FS.test);  //基本类型不会触发类加载
        System.out.println(FS.b1.name);
        FS a = new FS("1");
        a.text = 66;
        Calendar c = Calendar.getInstance();
        Object d = new Object();
        System.out.println(c.get(1));
        System.out.println(Calendar.YEAR);
        System.out.println(FS.text);
    }
}

class FS{
    int b = 10;
    String name;
    final static int test = 1;
    static int text = 33;
    final static FS b1 = new FS("1号");
    final static FS c1 = new FS("2号");
    static{
        System.out.println("触发类加载");
    }
    {
        System.out.println("new了一个");
    }
    //在类里面实例化自己会导致递归 栈溢出 FS a1 = new FS();
    FS(String name){
        ForStatic a1 = new ForStatic();
        this.name = name;
    }
}